home *** CD-ROM | disk | FTP | other *** search
/ Aminet 19 / Aminet 19 (1997)(GTI - Schatztruhe)[!][Jun 1997].iso / Aminet / comm / cnet / cnet_backup.lha / cnetamigabackup / CNetBackUp < prev    next >
Text File  |  1997-04-06  |  33KB  |  396 lines

  1. /**************************************************************************\
  2.      $VER: CNet Amiga BackUp, v3.51 (6-Apr-97) by Dotoran of Frontiers!
  3. \**************************************************************************/
  4. options results;signal on SYNTAX;signal on ERROR;signal on IOERR
  5. a=sourceline(2);parse var a . ", "ver" ("vdate")" .;a=random(,,time("s"))
  6. tr=transmit;se=sendstring;gc=getchar;gu=getuser;gs=getscratch;mg=maygetchar
  7. a="rexxsupport.library";if ~show("l",a) then if ~addlib(a,0,-30) then exit
  8. parse source . . fp .;df=left(fp,max(lastpos('/',fp),lastpos(':',fp)))
  9.  
  10. BEGIN:;changewhere "CNet BackUp";oldwhere=result;bdf=df"BackUp/"
  11.   gu 1100454;more=result;setobject 0;putuser 1100454;qa=0
  12.   fn=df"CNetBackUp.";cfg=fn"CFG";files=0;total=0;fn.="";tim=date(s)
  13.   if ~exists(cfg) then do;call FLOPPY
  14.     tr "n1cb`ca"df"CNetBackUp.CFGcb' c6File c9Not c6Found!"
  15.     tr "n1c7...cdtap any keyc7...g1";end;else call READCONFIG
  16. MENU:;tr "f1n1z4cer1     CNet Amiga BackUp, "ver"     r0z0n1"
  17.   tr "    cf<cdEcf> cdEdit File Parameters";tr "    cf<cbMcf> cbModify File Lists"
  18.   tr "    cf<cdAcf> cdAdd  a BackUp File";tr "    cf<cbKcf> cbKill a BackUp File"
  19.   tr "    cf<cdLcf> cdLog Viewer";tr "    cf<cbCcf> cbCreate Archive"
  20.   tr "    cf<cdFcf> cdFloppy Drives cf(cd"drives"cf)";tr "    cf<cbBcf> cbBackUp Files Now"
  21.   tr "    ca[cdQca] cdQuit CNet BackUpn1";se "z4cer1 Command r0z0cf: "
  22. MENU0:;gc;a=result;if a=d2c(13) then a="Q";if index("EMAKLCFBQ",a)=0 then signal MENU0
  23.   if a="E" then do;tr "cdEdit Parameters";call PICK("Edit");tr "f1";signal EDITPAR;end
  24.   if a="M" then do;tr "cbModify Lists";call PICK("Use");tr "f1";signal EDITCON;end
  25.   if a="A" then do;tr "cdAdd  Filef1";signal ADDFILE;end;if a="K" then do;tr "cbKill File";signal KILLFILE;end
  26.   if a="L" then do;tr "cdLog Viewer";call PICK("Read Log of");signal LOGVIEW;end
  27.   if a="C" then do;tr "cbCreate Archive";signal CREATEARC;end
  28.   if a="F" then do;tr "cdFloppy Drives";call FLOPPY;signal MENU;end;if a="B" then do;tr "cbBackUp Now";signal BACKUP;end
  29.   if a="Q" then do;tr "cdQuit Now";signal QUITBYE;end
  30. PICK:;parse arg text;if files=0 then do;tr "f1";signal ADDFILE;end
  31.   tr "f1n1z4cer1 BackUp Files z0r0n2ce[cd1ce] cd"nam.1
  32.   do i=2 to files;co="d";if i/2=i%2 then co="b";tr "cf<c"co||i"cf> c"co||nam.i;end i
  33.   se "n1cf<c9Qcf> c9Quitn2z4cer1 "text" Which z0r0cf: "
  34. PICK0:;gc;a=result;if a="Q"|a=""|datatype(a,"n")=0|a<1|a>files then do;tr "c9Quit";signal MENU;end
  35.   file=a;co="d";if a/2=a%2 then co="b";tr "c"co||nam.a;lo=1;hi=15;save=0;return
  36. EDITPAR:
  37.   se "f0z4cer1 Edit File Parameters z0r0cf: c6Last cb`caCNetBackUp.";se ext.file"cb' c6was c9"
  38.   d=tim.file;se left(date("w",d,"s"),3)"., "date("m",d,"s")" "strip(substr(d,7,2),"l","0");tr ", "left(d,4)"c6.n1"
  39.   se "cf<cdEcf> cd    File Extensioncf: z0car1"left(ext.file,3)"r0 "
  40.   if ext.file~="BAK" then tr;else tr "c6Only options cbBc6, cdIc6, cbLc6, cbSc6, and cdQ c6can be edited!"
  41.   tr "cf<cbBcf> cbBackUp Descriptioncf: z0car1"left(nam.file,50)"r0"
  42.   tr "cf<cdTcf> cd    TEMP/WORK Pathcf: z0car1"left(tem.file,50)"r0"
  43.   tr "cf<cbDcf> cb  DESTINATION Pathcf: z0car1"left(des.file,50)"r0"
  44.   tr "cf<cdIcf> cd  Interval in Dayscf: z0car1"left(day.file,3)"r0"
  45.   tr "cf<cbPcf> cb LHA Pack Prioritycf: z0car1"left(pri.file,3)"r0"
  46.   tr "cf<cdUcf> cd  Use FAST Displaycf: z0car1"left(word("No Yes",(dis.file)+1),3)"r0"
  47.   tr "cf<cbNcf> cb Do NO Compressioncf: z0car1"left(word("No Yes",(com.file)+1),3)"r0"
  48.   tr "cf<cdCcf> cdCreate Directoriescf: z0car1"left(word("No Yes",(dir.file)+1),3)"r0"
  49.   tr "cf<cbAcf> cbArc to Destinationcf: z0car1"left(word("No Yes",(bac.file)+1),3)"r0"
  50.   tr "cf<cdFcf> cd  Format Dest Pathcf: z0car1"left(word("No Yes/Full Yes/Quick",(for.file)+1),9)"r0"
  51.   tr "cf<cbLcf> cb  Last BackUp Datecf: z0car1"left(tim.file,8)"r0"
  52.   tr "cf<cdMcf> cdMail On Fails Onlycf: z0car1"left(word("No Yes",(mai.file)+1),3)"r0n1"
  53.   tr "cf<cbScf> cbSave This BackUp File!";tr "ce[cdQce] cdQuit / Check For Save!"
  54. EDITPAR0:;se "6Hz4cer1 Which Parameter z0r0cf: ";gc;a=result;if a=d2c(13) then a="Q";z=(ext.file~="BAK")
  55.   if (z&index("EBTDIPUNCAFLMSQ",a)=0)|(~z&index("BILSQ",a)=0) then signal EDITPAR0
  56.   if a="E" then do;tr "cdExtension";signal EXT;end;if a="B" then do;tr "cbBackUp Name";signal NAM;end
  57.   if a="T" then do;tr "cdTemp/Work Path";signal TEM;end;if a="D" then do;tr "cbDestination Path";signal DES;end
  58.   if a="I" then do;tr "cdInterval Days";signal DAY;end;if a="P" then do;tr "cbPack Priority";signal PRI;end
  59.   if a="U" then do;tr "cdUse FAST Display";signal DIS;end;if a="N" then do;tr "cbNo Compression";signal COM;end
  60.   if a="C" then do;tr "cdCreate Directories";signal DIR;end;if a="A" then do;tr "cbArc to Destination";signal BAC;end
  61.   if a="F" then do;tr "cdFormat";signal FOR;end;if a="L" then do;tr "cbLast Date";signal DAT;end
  62.   if a="M" then do;tr "cdMail Fails";signal MAI;end;if a="S" then do;tr "cbSave";signal SAV;end
  63.   if a="Q" then do;tr "cdQuit";signal QUI;end
  64. EXT:;addkeys (ext.file);tr "5Hz0car1i"1+4096" 3}r0";gu 70;a=result
  65.   bad=0;if a="" | a="CFG" | a="BAK" then bad=1;do i=1 to files;if ext.i=a & a~=ext.file then bad=1;end i
  66.   if bad=1 then do;a=ext.file;tr "9Hc9Invalid, reserved, or already used! cf<cdKeycf>g19H";signal EDITPAR;end
  67.   if exists(df"CNetBackUp."ext.file) then do;address command 'RENAME "'df'CNetBackUp.'ext.file'" "'df'CNetBackUp.'a'"'
  68.     end;if a~=ext.file then save=1;ext.file=a;signal EDITPAR
  69. NAM:;addkeys (nam.file);tr "5Hz0car1i"16+4096" 50}r0";gu 70;a=result
  70.   if a="" then a=nam.file;if a~=nam.file then save=1;tr "5Hcar1"a"r0";nam.file=a;signal EDITPAR0
  71. TEM:;addkeys (tem.file);tr "5Hz0car1i"4096" 50}r0";gu 70;a=result
  72.   if a="" & exists(bdf) then a=bdf;b=right(a,1);if b~=":" & b~="/" then a=a"/"
  73.   if word(statef(a),1)~="DIR" then do;a=tem.file;tr "9Hc9Invalid, or nonexistent directory! cf<cdKeycf>g19H"
  74.     signal EDITPAR;end;else tr "5Hcar1"a"r0";if a~=tem.file then save=1;tem.file=a;signal EDITPAR0
  75. DES:;addkeys (des.file);se "9HcaIf a FLOPPY drive, place diskette IN the drive..."
  76.   tr "5Hz0car1i"4096" 50}r0";gu 70;a=result
  77.   if a="" then a=des.file;b=right(a,1);if b~=":" & b~="/" then a=a"/";z=pragma("w","n")
  78.   if word(statef(a),1)~="DIR" then do;a=des.file;tr "9Hc9Invalid, or nonexistent directory! cf<cdKeycf>g19H"
  79.     signal EDITPAR;end;else tr "5Hcar1"a"r09H";if a~=des.file then save=1;des.file=a;z=pragma("w")
  80.   if index(drives,a)=0 then do;for.file=0;signal EDITPAR;end;signal EDITPAR0
  81. DAY:;addkeys (day.file);tr "5Hz0car1i"64+4096" 3}r0";gu 70;a=result
  82.   if a="" then a=day.file;if a<1 | a>365 then do;a=day.file;tr "9Hc9Interval MUST be between 1 and 365 Days! cf<cdKeycf>g19H"
  83.     signal EDITPAR;end;if a~=day.file then save=1;day.file=a;tr "5Hcar1"a"r0";signal EDITPAR0
  84. PRI:;addkeys (pri.file);tr "5Hz0car1i"4096" 3}r0";gu 70;a=result
  85.   if a="" then a=pri.file;if a<-5 | a>5 then do;a=pri.file;tr "9Hc9Priority MUST be between -5 and 5! cf<cdKeycf>g19H"
  86.     signal EDITPAR;end;if a~=pri.file then save=1;pri.file=a;tr "5Hcar1"a"r0";signal EDITPAR0
  87. DIS:;dis.file=~dis.file;save=1;tr "5Hcar1"left(word("No Yes",(dis.file)+1),3)"r0";signal EDITPAR0
  88. COM:;com.file=~com.file;save=1;tr "25Hcar1"left(word("No Yes",(com.file)+1),3)"r0";signal EDITPAR0
  89. DIR:;dir.file=~dir.file;save=1;tr "25Hcar1"left(word("No Yes",(dir.file)+1),3)"r0";signal EDITPAR0
  90. BAC:;bac.file=~bac.file;save=1;if bac.file=1 then for.file=0;signal EDITPAR
  91. FOR:;if index(" "drives" "," "upper(des.file)" ")=0 then do;tr "35Hc9Only when cf<cbDcf> c9is a Floppy Drive! cf<cdKeycf>g135H";signal EDITPAR;end
  92.   for.file=for.file+1;if for.file>2 then for.file=0;save=1;signal EDITPAR
  93. DAT:;addkeys (tim.file);tr "25Hz0car1i"64+4096" 8}r0";gu 70;a=result;if a="" then a=date("s");if a<19970101 | a>19991231 then do;a=tim.file
  94.   tr "34Hc9Dates Between 1/1/97 & 12/31/99! cf<cdKeycf>g134H"
  95.   signal EDITPAR;end;if a~=tim.file then save=1;tim.file=a;tr "25Hcar1"a"r0";signal EDITPAR
  96. MAI:;mai.file=~mai.file;save=1;tr "25Hcar1"left(word("No Yes",(mai.file)+1),3)"r0";signal EDITPAR0
  97. SAV:;if save=0 then signal QUI;else do i=1 to files;file.i=tim.i"|"ext.i"|"nam.i"|"tem.i"|"des.i"|"day.i"|"dir.i"|"bac.i"|"for.i"|"pri.i"|"mai.i"|"com.i"|"dis.i"|x";end i;call SAVECONFIG
  98. QUI:;if save=1 then do;se "n1caData c6has changed;cbSave c6first? c7[caYesc7]c6: "
  99.   gc;a=result;if a~="N" then do;tr "caYesc6!";signal SAV;end;else tr "cbNoc6.";end;bufferflush;signal MENU
  100. EDITCON:;call READFILE;if hi>total then hi=total
  101. EDITCON0:;tr "f0z4cer1 File List For z0r0cf: cb`ca"nam.file"cb'  cf(cd"total" c6Files c9Totalcf)n1"
  102.   do i=lo to hi;co="d";if i/2=i%2 then co="b";tr "c"co||right(i,2)"cf> c"co||fn.i"";end i
  103.   if hi//15>0 then do;h=hi%15;h=15-(hi-(h*15));do i=1 to h;tr "";end i;end
  104. EDITCON1:;a="cf<caAcf>caddc6, ";a1="cf<cbScf>cbavec6, ce[cdQce]cduitc6."
  105.   if total>0 then a=a"cf<c9Kcf>c9illc6, cf<ceEcf>ceditc6, cf<caCcf>calonec6, "
  106.   if total>hi then a=a"cf<ccNcf>ccext 15c6, ";if lo>1 then a=a"cf<c7Pcf>c7ast 15c6, ";tr "1Hz4cer1  Commands z0r0cf: "a||a1""
  107. EDITCON2:;se "1Hz4cer1 File List z0r0cf: ";gc;a=result
  108.   if a=d2c(13) then a="Q";if index("AKECNPSQ",a)=0 then signal EDITCON2
  109.   if a="A" then do;tr "caAdd";signal ADD;end;if a="K" & total>0 then do;tr "c9Kill";signal KILL;end
  110.   if a="E" & total>0 then do;tr "ceEdit";signal EDIT;end;if a="C" & total>0 then do;tr "caClone";signal CLONE;end
  111.   if a="N" & hi~=total then do;tr "ccNext";signal MORE;end;if a="P" & lo~=1 then do;tr "c7Past";signal LESS;end
  112.   if a="S" then do;tr "cbSave";signal SAVE;end;if a="Q" then do;tr "cdQuit";signal QUIT;end;signal EDITCON2
  113. ADD:;tr "3HcaPathc6/cbFilecf: z0car1"copies(" ",50)"Di"4096" 50}r0";gu 70
  114.   a=result;bad=0;if a="" then do;a="cnet:";tr "14Hz0car1"a"r0";end
  115.   do i=1 to total;if fn.i=a then bad=1;end i
  116.   if bad=1 then do;se "14Hc9File is already in this list! cf<cdKeycf>g1";signal EDITCON2;end
  117.   if right(upper(a),4)=".BAK" & ext.file="BAK" then do
  118.     se "14Hc9.bak files may NOT be added to a Clone BackUp! cf<cdKeycf>g1";signal EDITCON2;end
  119.   if word(statef(a),1)="DIR" | index(a,"*")>0 then signal ADD2
  120.   if ~exists(a) then do;se "14Hc9File does not exist at given path! cf<cdKeycf>g1"
  121.   signal EDITCON2;end;else total=total+1;save=1;fn.total=a;if total<15 then hi=total;signal EDITCON0
  122. ADD2:;aa=a;c=0;fl=0;z="";z1="";z2=""
  123.   if index(a,"*")>0 then do;f=lastpos("/",a)
  124.     if f=0 then f=lastpos(":",a);a=left(a,f)
  125.     z=substr(aa,f+1);z1=right(z,1);z2=left(z,1);end
  126.   if z1="*" & z2~="*" then do;z=strip(z,"t","*");fl=1;end
  127.   if z2="*" & z1~="*" then do;z=strip(z,"l","*");fl=2;end
  128.   if z1="*" & z2="*"  then do;fl=3;f1=length(z)
  129.     f2=f1-2;z=substr(z,2,f2);end
  130.   if z="" then do;se "3HcaThis is a c9Directoryca! cbADD cait as a cdFull Path canow? cf[c9Nocf]ca: "
  131.     gc;aq=result;if aq="Y" then do;tr "caYes";if index(":/",right(a,1))=0 then a=a"/"
  132.       total=total+1;save=1;fn.total=a;if total<15 then hi=total
  133.       signal EDITCON0;end;else tr "c9No3H";end
  134.   se "14HcbReadingc6...";d=showdir(a,"f","|");d=d"|xxx";call open(g1,"ram:CNetBackUp.TMP","w");do i=1 until a1="xxx"
  135.   parse var d a1"|"a2;if a1="xxx" then leave i;call writeln(g1,a1);d=a2;end i;call close(g1)
  136.   address command "SORT ram:CNetBackUp.TMP ram:CNetBackUp.TMP";all=0;an.=a;if right(a,1)~=":" & right(a,1)~="/" then an.=a"/"
  137.   l=length(z);z=upper(z);call open(g1,"ram:CNetBackUp.TMP","r")
  138.   do i=1 until eof(g1);a1=readln(g1);if a1="" then leave i
  139.   if fl=1 & left(upper(a1),l)~=z  then do;d=a2;iterate i;end
  140.   if fl=2 & right(upper(a1),l)~=z then do;d=a2;iterate i;end
  141.   if fl=3 & pos(z,upper(a1))=0    then do;d=a2;iterate i;end
  142.   if ext.file="BAK" & right(upper(a1),4)=".BAK" then do;d=a2;iterate i;end
  143.   if all=1 then addkeys ("A")
  144.   se "13Hc9"right(a1,25)" cf? c6(caYc6/cbnc6/c9ac6/celc6/cdqc6)cf: ";gc;b=result
  145.   if b="Q" then do;tr "cdQuit";leave i;end;if b="N" then do;tr "cbNo";end
  146.   if b="A" then do;tr "c9All";all=1;c=c+1;an.c=an.c||a1;save=1;iterate i;end
  147.   if b="L" then do;tr "ceLast";c=c+1;an.c=an.c||a1;save=1;leave i;end
  148.   if index("QNAL",b)=0 then do;tr "caYes";c=c+1;an.c=an.c||a1;save=1;end  
  149. ADD3:;d=a2;end i;call close(g1);address command "DELETE ram:CNetBa#?"
  150.   se "14HcbAdding cafilesc6...";do i=1 to total;do j=1 to c;if fn.i=an.j then an.j="";end j;end i;c2=0
  151.   do i=1 to c;if an.i~="" then do;c2=c2+1;an2.c2=an.i;end;end i;c=c2;do i=1 to c;total=total+1;fn.total=an2.i;end i
  152.   hi=15;if total<15 then hi=total;se "14Hc9"c" cafiles cbaddedc6.w1";signal EDITCON0
  153. KILL:;tot=total;tr "2Hc9Kill c6Whichcf: cai"4096+16384" 20}";gu 70;a=result;if a>"" then call PARSER(a)
  154.   if a="" | totpit=0 then do;tr "14Hc9Abortc6!";signal EDITCON2;end
  155.   do i=1 to totpit;j=it.i;fn.j="";end i;c=0;do i=1 to total;if fn.i>"" then do;c=c+1;f.c=fn.i;end
  156.   end i;do i=1 to c;fn.i=f.i;end i;total=c;save=1;lo=1;hi=15;if hi>total then hi=total;if total=0 then tr "f1";signal EDITCON0
  157. EDIT:;tot=total;tr "2HceEdit c6Whichcf: cai"4096+16384" 20}";gu 70;a=result;if a>"" then call PARSER(a)
  158.   if a="" | totpit=0 then do;tr "14Hc9Abortc6!";signal EDITCON2;end
  159.   do i=1 to totpit;z=it.i;addkeys (fn.z);tr "2H ceEdit c6Filecf: z0car1"copies(" ",50)"Di"4096" 50}r0"
  160.   gu 70;b=result;if word(statef(b),1)="DIR" then do
  161.   se "3HcaThis is a c9Directoryca! cbADD cait as a cdFull Path canow? cf[c9Nocf]ca: "
  162.   gc;aq=result;if aq~="Y" then do;tr "c9No3H";iterate i;end;else tr "caYes3H";end
  163.   if b="" | exists(b)=0 then do;se "14Hc9File does not exist at given path! cf<cdKeycf>g114H";iterate i;end
  164.   if ext.file="BAK" & right(upper(b),4)=".BAK" then do
  165.     se "14Hc9.bak files may NOT be added to a Clone BackUp! cf<cdKeycf>g114H";iterate i;end
  166.   else do;fn.z=b;save=1;end;end i;if save=0 then signal EDITCON2;else signal EDITCON0
  167. CLONE:;tot=total;tr "1HcaClone c6Whichcf: cai"4096+16384" 20}";gu 70;a=result;if a>"" then call PARSER(a)
  168.   if a="" | totpit=0 then do;tr "14Hc9Abortc6!";signal EDITCON2;end
  169.   do i=1 to totpit;z=it.i;addkeys (fn.z);se "1Hca Clone c6Filecf: z0car1"copies(" ",50)
  170.     tr "Di"4096" 50}r0";gu 70;b=result;if b=fn.z then do;se "1Hca Cloned cafiles must use cfunique cafilenames! cf<cdKeycf>g11H";iterate i;end
  171.     if b="" | exists(b)=0 then do;se "14Hc9File does not exist at given path! cf<cdKeycf>g114H";iterate i;end
  172.     if ext.file="BAK" & right(upper(b),4)=".BAK" then do
  173.       se "14Hc9.bak files may NOT be added to a Clone BackUp! cf<cdKeycf>g114H";iterate i;end
  174.     if word(statef(b),1)="DIR" then do;se "1Hca This is a c9Directoryca! cbADD cait as a cdFull Path canow? cf[c9Nocf]ca: "
  175.       gc;aq=result;if aq="Y" then do;tr "caYes";if index(":/",right(b,1))=0 then b=b"/"
  176.       total=total+1;save=1;fn.total=b;if total<15 then hi=total;iterate i;end
  177.     else do;tr "c9No1H";iterate i;end;end
  178.     total=total+1;save=1;fn.total=b;if total<15 then hi=total
  179.   end i;if save=0 then signal EDITCON2;else signal EDITCON0
  180. MORE:;lo=lo+15;hi=lo+14;if hi>total then hi=total;signal EDITCON0
  181. LESS:;lo=lo-15;hi=lo+14;if hi>total then hi=total;signal EDITCON0
  182. SAVE:;if qa then signal CREATEARC2;if save=1 then call SAVEFILE
  183. QUIT:;if save=1 then do;se "1HcaData c6has changed;cbSave c6first? c7[caYesc7]c6: "
  184.   gc;a=result;if a~="N" then do;tr "caYesc6!";signal SAVE;end;else tr "cbNoc6.";end;bufferflush;signal MENU
  185. ADDFILE:;tr "f0z4cer1  Add BackUp File z0r0cf:n1";a=""
  186.   tr "cd    File Extensioncf: z0car1   r0";tr "cbBackUp Descriptioncf: z0car1"left(a,50)"r0"
  187.   tr "cd    TEMP/WORK Pathcf: z0car1"left(bdf,50)"r0";tr "cb  DESTINATION Pathcf: z0car1"left(a,50)"r0"
  188.   tr "cd  Interval in Dayscf: z0car1   r0";tr "cb LHA Pack Prioritycf: z0car1   r0"
  189.   tr "cd  Use FAST Displaycf: z0car1   r0";tr "cb Do NO Compressioncf: z0car1   r0"
  190.   tr "cdCreate Directoriescf: z0car1   r0";tr "cbArc to Destinationcf: z0car1   r0"
  191.   tr "cd  Format Dest Pathcf: z0car1         r0";tr "cbMail On FAILS Onlycf: z0car1   r0n1"
  192.   tr "c6Type cb`cdQcb' c6in cdANY c6field to c9Abortc6."
  193. ADDFILE0:;se "1Hz0car1i"1+4096" 3}r0";gu 70;a=result;bad=0
  194.   if a="Q" then signal MENU;if a="CFG" then bad=1;if a="" then a="CNB"
  195.   if a="BAK" then do;se "5Hc6Create a ceClone cbBackUpc6? c7[caYesc7]c6: ca";gc;z=result;clone=0
  196.     if z="N" then do;tr "c9Noc6.";signal MENU;end;tr "Yesc6!";clone=1;end
  197.   do i=1 to files;if ext.i=a then bad=1;end i;if bad=1 then do
  198.     tr "5Hc9Invalid, reserved, or already used! cf<cdKeycf>g15H"
  199.   signal ADDFILE0;end;else ext=a;tr "1Hz0car1"a"r0"
  200. ADDFILE1:;se "1Hz0car1i"16+4096" 50}r0";gu 70;a=result;if upper(a)="Q" then signal MENU
  201.   if a="" then a="BackUp File # "files+1;nam=a;tr "1Hz0car1"left(nam,50)"r0"
  202. ADDFILE2:;if ext~="BAK" then do
  203.     se "1Hz0car1L1305640 #"bdf"}i"4+4096" 50}r0";gu 70;a=result;if upper(a)="Q" then signal MENU
  204.     if a="" & exists(bdf) then a=bdf;if a="" | word(statef(a),1)~="DIR" then do
  205.     tr "5Hc9Invalid or nonexistent directory! cf<cdKeycf>g15H"
  206.     signal ADDFILE2;end;else tem=a;if right(tem,1)~=":" & right(tem,1)~="/" then do;tem=tem"/";end
  207.   end ; else tem="[Not Used]"
  208.   tr "1Hz0car1"left(tem,50)"r0"
  209. ADDFILE3:;if ext~="BAK" then do
  210.     if words(drives)>1 & index(drives,"DF1:")>0 then des="DF1:";else des=""
  211.     se "5HcaIf a FLOPPY drive, place diskette IN the drive..."
  212.     se "1Hz0car1L1305640 #"des"}i"1+4+4096" 50}r0";gu 70;a=result
  213.     if upper(a)="Q" then signal MENU;if a="" & drives>"" then a=word(drives,1);z=pragma("w","n")
  214.     if word(statef(a),1)~="DIR" then do;tr "5Hc9Invalid or nonexistent directory! cf<cdKeycf>g15H";z=pragma("w")
  215.     signal ADDFILE3;end;else des=a;if right(des,1)~=":" & right(des,1)~="/" then do;des=des"/";end
  216.   end ; else des="[Not Used]"
  217.   tr "1Hz0car1"left(des,50)"r05H"
  218. ADDFILE4:;se "1Hz0car1L1305640 #1}i"4+64+4096" 3}r0";gu 70;a=result;if upper(a)="Q" then signal MENU;if a="" then a=1;if a<1 | a>365 then do
  219.   tr "5Hc9Interval MUST be between 1 and 365 days! cf<cdKeycf>g15H";signal ADDFILE4;end;else day=a;tr "1Hz0car1"left(a,3)"r0"
  220. ADDFILE5:;if ext~="BAK" then do
  221.     se "1Hz0car1L1305640 #0}i"4+4096" 3}r0";gu 70;a=result;if upper(a)="Q" then signal MENU;if a="" then a=1;if a<-5 | a>5 then do
  222.     tr "5Hc9Priority MUST be between -5 and 5! cf<cdKeycf>g15H";signal ADDFILE5;end;else pri=a
  223.   end ; else pri=0
  224.   tr "1Hz0car1"left(pri,3)"r0"
  225. ADDFILE6:;if ext~="BAK" then do
  226.     se "5HUse FAST LHA Screen Displays? [Y/n]: ";gc;a=result
  227.     if a="N" then dis=0;else dis=1;se word("No Yes",dis+1)
  228.   end ; else dis=0
  229.   se "1Hz0car1"left(word("No Yes",dis+1),3)"r0"
  230. ADDFILE7:;if ext~="BAK" then do
  231.     se "25HDisable LHA File Compression? [y/N]: ";gc;a=result
  232.     if a="Y" then com=1;else com=0;se word("No Yes",com+1)
  233.   end ; else com=0
  234.   se "21Hz0car1"left(word("No Yes",com+1),3)"r0"
  235. ADDFILE8:;if ext~="BAK" then do
  236.     se "25HCreate separate directory structures? [y/N]: ";gc;a=result
  237.     if a="Y" then dir=1;else dir=0;se word("No Yes",dir+1)
  238.   end ; else dir=0
  239.   se "21Hz0car1"left(word("No Yes",dir+1),3)"r0"
  240. ADDFILE9:;if dir=0 then do;bac=0;se "21Hz0car1"left(word("No Yes",bac+1),3)"r0";signal ADDFILE10;end
  241.   se "25HCreate archive directly in `"des"'? [Y/n]: ";gc;a=result;if a="N" then bac=1;else bac=0;se word("No Yes",bac+1)
  242.   se "21Hz0car1"left(word("No Yes",bac+1),3)"r0"
  243. ADDFILE10:;if ext~="BAK" then do
  244.     se "30HFormat destination? [y/N]: ";gc;a=result;if a="Q" then signal MENU
  245.     if a~="Y" then do;tr "21Hz0car1No r0";for=0;signal ADDFILE11;end
  246.     if index(" "drives" "," "upper(des)" ")=0 then do;tr "30Hc9Only when Dest. is one of these> ca"drives" cf<cdKeycf>g130H"
  247.       signal ADDFILE8;end;else do;tr "21Hz0car1Yesr0";for=1;end
  248.     se "30HUse [Q]uick or <F>ull FORMAT? [f/Q]: ";gc;a=result
  249.     if a="F" then tr "21Hz0car1Yes/Full r0";else do;tr "21Hz0car1Yes/Quickr0";for=2;end
  250.   end ; else do ; for=0 ; tr "21Hz0car1No r0" ; end
  251. ADDFILE11:;if ext~="BAK" then do
  252.     se "25HReceive Mail ONLY if Integrity Test FAILS? [Y/n]: ";gc;a=result
  253.     if a="N" then mai=0;else mai=1;se word("No Yes",mai+1)
  254.   end ; else mai=0
  255.   se "21Hz0car1"left(word("No Yes",mai+1),3)"r0"
  256. ADDFILE12:;se "n4If the above is correct, press ENTER to begin entering the file "
  257.   se "information for this BackUp Set, else press "Q" to Quit, without "
  258.   se "adding this listing...";gc;a=result;if a="Q" then signal MENU;files=files+1;se "f1"
  259.   file.files=tim"|"ext"|"nam"|"tem"|"des"|"day"|"dir"|"bac"|"for"|"pri"|"mai"|"com"|"dis"|x"
  260.   call SAVECONFIG;file=files;lo=1;hi=15;save=1;signal EDITCON
  261. KILLFILE:;if files=0 then do;se "n1c9No BackUp Files Created to Kill! cf<cdKeycf>g1";signal MENU;end;else call PICK("Kill")
  262.   se "n1c6Really c9KILL cb`ca"nam.a"cb'c6? c7[cbNoc7]c6: ";gc;b=result;if b~="Y" then do;tr "cbNoc6.";signal MENU;end;else tr "caYesc6!"
  263.   if exists(df"cnetbackup."ext.a) then address command 'DELETE "'df'CNetBackUp.'ext.a'"'
  264.   file.a="";do i=1 to files;j=i+1;if file.i="" then do;file.i=file.j;file.j="";end;end i;files=files-1;call SAVECONFIG;signal MENU
  265. LOGVIEW:;if ~exists("SysData:Log/CNetBackUp_"ext.file) then do
  266.   se "n1c6There is c9NO cb`caCNetBackUp_"ext.file"cb' c6log in cb`caSysData:Log/cb'c6... cf<cdKeycf>g1"
  267.   signal MENU;end;tr "*0SysData:Log/CNetBackUp_"ext.file"}cf<cdKeycf>g1";signal MENU
  268. CREATEARC:;f=right(date("s"),4)left(compress(time(),":"),4)
  269.   se "n1  caFilename c6for this archive? cf[ca"f"cf]c6: caI0 15}";gu 70;a=result;if a="" then a=f
  270.   if upper(right(a,4))~=".LHA" then a=a".LHA";fn2=a;se "caCreate c6archive in which path? cf[caPROGDIRcf]c6: caI0 40}";gu 70;a=result
  271.   if a="" | word(statef(a),1)~="DIR" then a=df;df2=a;se "n1c6Use cb`ca"df2||fn2"cb' c6as the cbPath/Filenamec6? cf[caYescf]c6: ";gc;a=result
  272.   if a="N" then do;tr "c9No";signal MENU;end;else do;tr "caYesf1";pf=df2||fn2;end
  273.   lo=1;hi=15;file=0;nam.file=fn2;qa=1;signal EDITCON
  274. CREATEARC2:;if total=0 then do;se "c9No files selected! cf<ceKeycf>g1";signal MENU;end;tr "f1cbCreate Archivecen1"
  275.   if exists(pf) then do;se "c6A cb`ca"pf"cb' c6archive cdalready existsc6.n2cf<c9Dcf>c9elete c6or cf<cbRcf>cbenamec6? cf[c9DELETEcf]c6: ";gc;a=result
  276.     if a~="R" then do;tr "c9Delete";address command "delete "pf;end
  277.   else do;aa=left(fn2,length(fn2)-4)date("s")".LHA";se "cbRenamen2c6Enter canew c6filename? cf[ca"aa"cf]c6: caI0 40}";gu 70;a=result
  278.     if upper(right(a,4))~=".LHA" then a=a".LHA";if a="" | a=".LHA" then a=aa;address command 'rename "'pf'" "'df2||a'"';end;end
  279. CREATEARC3:;fi.="";fi=1;do i=1 to total
  280.   if right(fn.i,1)="/" then fn.i=left(fn.i,length(fn.i)-1)
  281.   if length(pf||fi.fi||fn.i)+26<=150 then fi.fi=fi.fi" "fn.i;else do;fi=fi+1;fi.fi=fi.fi" "fn.i;end;end i
  282.   tr "n1c6Creating cb`ca"pf"cb' c6archive...n1ce"
  283.   do i=1 to fi;lfn1="";lfn2="";do j=1 to words(fi.i);f.j=word(fi.i,j)
  284.     if word(statef(f.j),1)~="DIR" then lfn2=lfn2" "f.j;else lfn1=lfn1" "f.j
  285.     end j;fi.i=strip(lfn1)" "strip(lfn2);tr "#4LHA -arex2D2P1 a "pf" "fi.i"}";end i
  286.   tr "n1c6Testing c9integrity c6of cb`ca"pf"cb' c6archive...n1"
  287.   se "#4LHA -P1 t >ram:testLHA "pf"}";call open(f1,"ram:testLHA","r")
  288.     do i=1 until eof(f1);l.i=readln(f1);end i;t=i-1
  289.   call close(f1);check=substr(l.t,11,7);if check="success" then do 
  290.     test=1;tr "caPassed Integrity Check!";end
  291.     else do;test=0;tr "c9Failed Integrity Check!";end
  292.   if test=0 then do;se "Attempt to pack archive again? [Yes]: ";gc;a=result
  293.     if a="N" then do;tr "No.";signal QUITBYE;end;tr "Yes!";signal CREATEARC3;end
  294.   tr "n1c6The cb`ca"pf"cb' c6archive was created!n1"
  295.   se "cbSend c6this archive to which user? cf[c9ABORTcf]c6: cbI0 30}";gu 70;a=result
  296.   if a="" then do;tr "c9Abortc6!";signal QUITBYE;end;if datatype(a,"n")=0 then do;findaccount a;a=result;end
  297.   loadscratch a;savescratch (-a);st=result;getscratch 1;han=result;getscratch 39;md=result
  298.   if a=0 | st=0 | han="!" then do;tr "c9Invalid User Accountc6!";signal QUITBYE;end;address command "COPY "pf" mail:users/"md"/"fn2
  299.   se "n1c6Sending cb`camail:users/"md"/"fn2"cb' c6archive to cd"han" cf(c6ID#cd"a"cf) c6now...n1"
  300.   addkeys "MS`"a"```"fn2"`f`mail:users/"md"/"fn2"`Here are the files you requested!`.s`";changewhere oldwhere;signal QUITBYE
  301. FLOPPY:;drives="";do i=0 to 9;if showlist("W","DF"i) then drives=drives"DF"i": ";end i;drives=strip(drives);call SAVECONFIG;return
  302. BACKUP:;if files=0 then do;se "n1c9No BackUp Files to BackUp! cf<cdKeycf>g1";signal MENU;end;else call PICK("BackUp")
  303.   se "n1ceBackUp c6using cb`ca"nam.a"cb' c6File? c7[caYesc7]c6: ";gc;b=result;if b="N" then do;tr "cbNoc6.";signal MENU;end
  304.   tr "caYesc6!";file=a;call READFILE;if total=0 then do
  305.   se "n1c9The cb"nam.a" c9BackUp File is EMPTY! cf<cdKeycf>g1";signal MENU;end
  306.   tem=tem.file;des=des.file;bname="CNetBackUp_"ext.a".LHA";z=(ext.a~="BAK")
  307.   tr "f1n1z4cer1 Backing Up CNet Using `"nam.a"' File z0r0n1"
  308.   if z then do
  309.     do until aa=1;z=pragma("w","n");aa=exists(des);z=pragma("w")
  310.     if aa=0 then se "cbInsert c6a disk into ca"des" c6and cdhit any keyc6...g1n1";end
  311.     if exists(des||bname) then do;address command 'PROTECT "'des||bname'" d'
  312.       address command 'DELETE "'des||bname'"';end
  313.   end
  314.   mi=0;miF.=0;fi=1;fi.=""
  315.   do i=1 to total;fn=fn.i;tr "cf[z0car1 Testing File r0cf> ca"fn
  316.     if ~exists(fn) then do;tr "cf[z5cb Missing File z0cf> cd"fn;mi=mi+1;mi.mi=fn;miF.i=1;iterate i;end
  317.     if z then do
  318.       if dir.a then do;f1=pos(":",fn);d1=left(fn,f1-1);fn=substr(fn,f1+1)
  319.         if ~exists(tem||d1) then do;tr "cf[z0c9r1 Creating Dir r0cf> c9"d1;address command 'MAKEDIR "'tem||d1'"';end
  320.         do j=1 until f1=0;f1=pos("/",fn);if f1>0 then do;d1=d1"/"left(fn,f1-1);fn=substr(fn,f1+1);end
  321.           if ~exists(tem||d1) then do;tr "cf[z0c9r1 Creating Dir r0cf> c9"d1;address command 'MAKEDIR "'tem||d1'"';end
  322.         end j;tr "cf[z0cbr1 Copying File r0cf> cb"fn.i;address command 'COPY "'fn.i'" "'tem||d1'/'fn'"';end
  323.       else do;if index(":/",right(fn,1))>0 then fn=left(fn,length(fn)-1)
  324.         if length(tem||bname||fi.fi||fn)+26<=150 then fi.fi=fi.fi" "fn
  325.         else do;fi=fi+1;fi.fi=fi.fi" "fn;end;end
  326.     end
  327.     else do
  328.       if index(":/",right(fn.i,1))>0 then do ; zy=showdir(fn.i,"f"," ")
  329.         tr "cf[z0cdr1 Cloning Path r0cf> cd"fn.i"#?.bak"
  330.         do j=1 to words(zy) ; zz=word(zy,j)
  331.           if right(upper(zz),4)~=".BAK" then do ; se "   "zz".bak..."
  332.             address command 'COPY "'fn.i||zz'" "'fn.i||zz'.bak" COM';tr "ok";end
  333.         end j
  334.       end
  335.       else do
  336.         tr "cf[z0cdr1 Cloning File r0cf> cd"fn.i".bak"
  337.         address command 'COPY "'fn.i'" "'fn.i'.bak" COM'
  338.       end
  339.     end
  340.   end i;file.file=overlay(tim,file.file,1);call SAVECONFIG
  341.   if for.file>0 then do;tr "cf[z0ccr1 Formatting.. r0cf> cc"des"  cf(cc"word("FULL QUICK",for.file)"cf)"
  342.     form="";if for.file=2 then form="QUICK";do until a=1;z=pragma("w","n");a=exists(des);z=pragma("w")
  343.     if a=0 then se "cbInsert c6a disk into ca"des" c6and cdhit any keyc6...g1n1";end
  344.     tr "#4FORMAT <nil: drive "des" name CNetBackUps NOICONS "form" FFS}";end
  345.  
  346.   if z then do
  347.     tr "cf[z0cer1 Packing File r0cf> ce"bname"n1";zz="";if com.file then zz="z";z2="";if dis.file then z2="F"
  348.     temp=tem;if bac.file then temp=des.file;if dir.file then tr "#4LHA -arex2D2"zz||z2"P"pri.file" a "temp||bname" "tem"#?}"
  349.     else do;do i=1 to fi;lfn1="";lfn2="";do j=1 to words(fi.i);f.j=word(fi.i,j)
  350.       if word(statef(f.j),1)~="DIR" then lfn2=lfn2" "f.j;else lfn1=lfn1" "f.j;end j;fi.i=strip(lfn1)" "strip(lfn2)
  351.       tr "#4LHA -arex2D2"zz||z2"P"pri.file" a "temp||bname" "fi.i"}";end i;end
  352.     if com.file then do;tr "#4LHA -arex2D2Z"z2"P"pri.file" a "temp||bname"2 "temp||bname"}"
  353.       tr "#4DELETE "temp||bname"}";tr "Renaming `"temp||bname"2'...#4RENAME "temp||bname"2 "temp||bname"}ok";end
  354.     if ~bac.file then do;if exists(des||bname) then do;a=des||bname;c=2
  355.       do until ~exists(des||a);a=left(bname,length(bname)-4)"_"c".LHA";c=c+1;end
  356.       tr "cf[z0cer1 LHA Exists...r0cf> c6renamed as cb`ca"a"cb'"
  357.       address command 'rename "'des||bname'" "'tem||a'"';end
  358.     tr "cf[z0cdr1 Copying File r0cf> cd"bname;address command 'COPY "'tem||bname'" "'des||bname'"';end
  359.     d=date("s");da=left(date("w",d,"s"),3)"., "date("m",d,"s")" "strip(substr(d,7,2),"l","0")", "left(d,4)" @ "time("c")
  360.     com="CNet Amiga BackUp, "ver" Created on "da;address command 'FILENOTE "'des||bname'" "'com'"'
  361.     address command 'PROTECT "'des||bname'" re'
  362.     if dir.file | ~bac.file then do;tem=tem.file;tr "cf[z0c6r1 Cleaning Up! r0cf> c6"tem
  363.       address command "DELETE "tem"#? ALL";end
  364.     se "cf[z0cbr1 Testing LHA  r0cf> ";log=left(bname,length(bname)-4)
  365.     se "#4LHA -P"pri.file" t >sysdata:log/"log" "des||bname"}"
  366.     call open(f1,"sysdata:log/"log,"r");do i=1 until eof(f1);l.i=readln(f1);end i;t=i-1;call close(f1);check=substr(l.t,11,7)
  367.     if check="success" then do;test=1;tr "caPassed Integrity Check!";end;else do;test=0;tr "c9Failed Integrity Check!";end
  368.     call open(f1,"sysdata:log/"log,"a");call writeln(f1,"");call writeln(f1,com);call close(f1)
  369.   end
  370.  
  371.   if test=0 | mi>0 | mai.file=0 then do
  372.     if exists("sysdata:log/"log) then tr "n1c9Log c6Filecf: cb`caSysData:Log/"log"cb'cen1*0sysdata:log/"log"}"
  373.     if mi>0 then do;tr "c6The following files were cfMISSING c6and were c9NOT c6just backed up:n1"
  374.       do i=1 to mi;tr "  c"substr("db",(i/2=i%2)+1,1)mi.i;end i;end;end
  375.   se "n1cbCompletedc6... Press cdAny Key c6Now...g1";signal BEGIN
  376. SAVECONFIG:;call open(f1,cfg,"w");call writeln(f1,files);do i=1 to files;call writeln(f1,file.i);end i;call writeln(f1,drives);call close(f1);save=0
  377. READCONFIG:;call open(f1,cfg,"r");files=readln(f1);do i=1 to files;file.i=readln(f1)
  378.   parse var file.i tim.i"|"ext.i"|"nam.i"|"tem.i"|"des.i"|"day.i"|"dir.i"|"bac.i"|"for.i"|"pri.i"|"mai.i"|"com.i"|"dis.i"|"j;end i;drives=readln(f1);call close(f1);return
  379. SAVEFILE:;if total=0 then do;if exists(fn||ext.file) then address command 'DELETE "'fn||ext.file'"';total=0;save=0;return;end
  380.   call open(f1,fn||ext.file,"w");do i=1 to total;call writeln(f1,fn.i);end i;call close(f1);save=0
  381.   address command 'SORT "'fn||ext.file'" "'fn||ext.file'"'
  382. READFILE:;if ~exists(fn||ext.file) then do;total=0;return;end;call open(f1,fn||ext.file,"r")
  383.   do i=1 until eof(f1);fn.i=readln(f1);end i;call close(f1);total=i-1;return
  384. PARSER:;parse arg r;rr="";do ii=1 to length(r);a=substr(r,ii,1);if index("0123456789-,",a)=0 then iterate ii;rr=rr||a;end ii;r=rr;a=pos(",",r);ii=0;jj=0
  385.   if a>0 then do;do ii=1 until pos(",",r)=0;a=pos(",",r);v.ii=left(r,a-1);r=substr(r,a+1);end ii;ii=ii+1;v.ii=r;r1=ii;end;else do;r1=1;v.1=r;end
  386.   do ii=1 to r1;a=pos("-",v.ii);if right(v.ii,1)="-" then v.ii=v.ii||tot;if left(v.ii,1)="-" then do;v.ii="1"v.ii;a=a+1;end;if a=0 then do;jj=jj+1;it.jj=v.ii;iterate ii;end
  387.   l1=left(v.ii,a-1);l2=substr(v.ii,a+1);low=min(l1,l2);high=max(l1,l2);do k=low to high;jj=jj+1;it.jj=k;end k;end ii;totpit=jj;return
  388. QUITBYE:;setobject more;putuser 1100454;bufferflush;logentry "CNet BackUp Used.";changewhere oldwhere;exit
  389. SYNTAX:;ERROR:;IOERR:;e1="n1 Error: "rc" ("errortext(rc)")"
  390.   e2="  Line: "left(sigl,4)"File:";c="`"fp", "ver"'";e2=e2" "c;tr e1;tr e2
  391.   logentry e1;logentry e2;e=strip(translate(sourceline(sigl),"\{",""))
  392.   do while e~="";e3="Source: "left(e,37);tr e3;logentry e3;e=substr(e,38);end
  393.   bufferflush;signal QUITBYE
  394. /**************************************************************************\
  395. \****************************************** Frontiers BBS (716)/823-9892 **/
  396.